{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convolutional Autoencoder"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](https://cdn-images-1.medium.com/max/800/1*LSYNW5m3TN7xRX61BZhoZA.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In this example we will demonstrate how you can create a convolutional autoencoder in Gluon"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import mxnet as mx\n",
    "from mxnet import autograd, gluon"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Data\n",
    "\n",
    "We will use the FashionMNIST dataset, which is of a similar format to MNIST but is richer and has more variance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "batch_size = 512\n",
    "ctx = mx.gpu() if mx.context.num_gpus() else mx.cpu()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "transform = lambda x,y: (x.transpose((2,0,1)).astype('float32')/255., y)\n",
    "\n",
    "train_dataset = gluon.data.vision.FashionMNIST(train=True)\n",
    "test_dataset = gluon.data.vision.FashionMNIST(train=False)\n",
    "\n",
    "train_dataset_t = train_dataset.transform(transform)\n",
    "test_dataset_t = test_dataset.transform(transform)\n",
    "\n",
    "train_data = gluon.data.DataLoader(train_dataset_t, batch_size=batch_size, last_batch='rollover', shuffle=True, num_workers=5)\n",
    "test_data = gluon.data.DataLoader(test_dataset_t, batch_size=batch_size, last_batch='rollover', shuffle=True, num_workers=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABIEAAACBCAYAAABXearSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJztnXm4VmW5/2+q0+QQ5iwITkwOCKKghWLOSuZsNqk5HI+WiXoqT9ox09LqKr2wKK/UIjNLvRrMIU3AMENESHECkUkEHBFTGk51PH/8fjx9n297Pb1uNnu/77s+n7/utZ9nr7Xe9YxrXff3vnu9/vrrAQAAAAAAAAAA7c2bevoGAAAAAAAAAABg7cNHIAAAAAAAAACAGsBHIAAAAAAAAACAGsBHIAAAAAAAAACAGsBHIAAAAAAAAACAGsBHIAAAAAAAAACAGsBHIAAAAAAAAACAGsBHIAAAAAAAAACAGsBHIAAAAAAAAACAGvCW7rxYr169Xu/O68E/eP3113t1xXlow56jq9owYu2347/9278l+69//WtD/3P66adnx6+++mqy3/GOdyT7rW99a1bvL3/5S7L79++flX3+85/v8FpvetObKo//9re/ZWW9ev3jsb/++po/tu4ei3r/fvy///u/a3wfZ599drIPOOCArOzOO+9M9rRp05K9aNGirN7w4cOT3a9fv6xszJgxyda+dMEFF2T1nnnmmYbutyvas5XGYlcwdOjQZM+ePTvZG2+8cVZv5513Tvbdd9+99m9sDenusajz4v+/vp6j8v90nPrcpf+nc1dXjO0Seh9+7295yz+2ln//+98rz1H6zY2uG3Ubi9/73veSrW2wYsWKrN52222X7Hnz5mVll156abJfeOGFrr7FTsEetfVp5rH45je/OTvWubc0V44ePTrZP/3pT7Oyl156Kdnrr79+sv/nf/4nq/f2t7892ZdccklW9q1vfat02x2i82vEP+9Z15R2Hou+5lTtAb/+9a9nxzrvPvroo5Xn7Ip3hK6g0TbEEwgAAAAAAAAAoAbwEQgAAAAAAAAAoAb06k7XpWZ0DasL7ezeVxea2dW2s0yYMCHZhx56aFa2cuXKZM+ZMyfZG220UVZvp512Svaf/vSnrGz69OnJPvroozt1j60uB+vg//ReKuttttlmyf7hD3+YlS1fvjzZ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ptumtXTeWDUqFEd/Iquo6fXRVhzmm0szpw5M9m67kfkY8DHh86Pb3vb25Kt8XZKZfp3P/a4PLoWapnHq9U4Qz5OJ06cmGyNV+Mx+xp932+3sViKK6zv8pMmTUq29h3nxhtvzI6PPfbYDut19vl3BcQEAgAAAAAAAACABB+BAAAAAAAAAABqwFv+dZXmQtOhurvWihUrku3uferyqrIQTTkcEXHOOeck+9JLL0329ttvn9VT+Yu7/qlL9rPPPtvhuSMiPvvZzyZbU/xFrH03+HbGXfBW01lXvCOOOCLZ6r4ekafdLbn+NUvawK7kQx/6ULI13WZE7pruqWpV7qNlLuWqSiXvaTp1bLsLrUoMdJy6VGWDDTZItqf31LSROie0KppyXeVQCxcuzOoNGjQo2SeddFJWps9SXae//e1vZ/VUMrLvvvsm26ULW221VbL79++fle25557J1jne+fGPf5xsn6+1fbWPHHXUUVk9T2fdDmgbuyu0PheVNbsERce31vO5TCUtXqZyMJ0PfdyrlK/d1kGfn3yfspqTTz658hwuKdMxNm3atGT7nKxz4TrrrJPsnXbaqfJa3jYqzdR9zuDBg7N6Or69L40bNy7Zup62y7pYYq+99kr2lltumZXpXlH7iUo2vZ6un94vXnvttWTrGhmRt6uORd3PROTzsktJ77jjjgBoNlSernOPSpUjchmyS091Xtax6POhjr/7778/2T6nVr0LRORrskrDqt5jIvKxHfHP829H160zvu9Rtt1222R/9atfTXbpfc7n5AMPPDDZd955Z7K1Pf/VffQUeAIBAAAAAAAAANQAPgIBAAAAAAAAANSAppGDNSqXUXd9zTYTkbvIuRuWuj+rG7PLElR2Mn78+GS7m6y617qLoEaJ19/yzDPPZPU0y8Ps2bOzMj/nanoy2nizsjaeibp5qmzPJTPaL0rXbcd2GjFiRLJ9vKk77brrrpuV6bGOFZdhqWRLn59noFK3ei/TMadu9C45Urw/DRkypLJuK3LGGWckW+egE088Maun0o/hw4dnZZqhSJ/XMccck9V7/PHHk61ZEz27hWZp1HaKyN2s586dm2x34VapsGcC0f/TvuTXakdU0uGyEF3v1HXe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b1+Zf2fLo3jMjXD7X93eTVV1/t8Foei033rB4jU2Mc6nrscYoeeuihZH/4wx/u4Fd0HY22IZ5AAAAAAAAAAAA1gI9AAAAAAAAAAAA1oFvlYAAAAAAAAAAA0DPgCQQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP4CAQAAAAAAAAAUAP+D/fLABOCduBWAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1440x720 with 10 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(20,10))\n",
    "for i in range(10):\n",
    "    ax = plt.subplot(1, 10, i+1)\n",
    "    ax.imshow(train_dataset[i][0].squeeze().asnumpy(), cmap='gray')\n",
    "    ax.axis('off')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Network"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "net = gluon.nn.HybridSequential()\n",
    "encoder = gluon.nn.HybridSequential()\n",
    "encoder.add(\n",
    "    gluon.nn.Conv2D(channels=4, kernel_size=3, padding=1, strides=(2,2), activation='relu'),\n",
    "    gluon.nn.BatchNorm(),\n",
    "    gluon.nn.Conv2D(channels=8, kernel_size=3, padding=1, strides=(2,2), activation='relu'),\n",
    "    gluon.nn.BatchNorm(),\n",
    "    gluon.nn.Conv2D(channels=16, kernel_size=3, padding=1, strides=(2,2), activation='relu'),\n",
    "    gluon.nn.BatchNorm(),\n",
    "    gluon.nn.Conv2D(channels=32, kernel_size=3, padding=0, strides=(2,2),activation='relu'),\n",
    "    gluon.nn.BatchNorm()\n",
    ")\n",
    "decoder = gluon.nn.HybridSequential()\n",
    "decoder.add(\n",
    "    gluon.nn.Conv2D(channels=32, kernel_size=3, padding=2, activation='relu'),\n",
    "    gluon.nn.HybridLambda(lambda F, x: F.UpSampling(x, scale=2, sample_type='nearest')),\n",
    "    gluon.nn.BatchNorm(),\n",
    "    gluon.nn.Conv2D(channels=16, kernel_size=3, padding=1, activation='relu'),\n",
    "    gluon.nn.HybridLambda(lambda F, x: F.UpSampling(x, scale=2, sample_type='nearest')),\n",
    "    gluon.nn.BatchNorm(),\n",
    "    gluon.nn.Conv2D(channels=8, kernel_size=3, padding=2, activation='relu'),\n",
    "    gluon.nn.HybridLambda(lambda F, x: F.UpSampling(x, scale=2, sample_type='nearest')),\n",
    "    gluon.nn.BatchNorm(),\n",
    "    gluon.nn.Conv2D(channels=4, kernel_size=3, padding=1, activation='relu'),\n",
    "    gluon.nn.Conv2D(channels=1, kernel_size=3, padding=1, activation='sigmoid')\n",
    ")\n",
    "net.add(\n",
    "        encoder,\n",
    "        decoder\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "net.initialize(ctx=ctx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--------------------------------------------------------------------------------\n",
      "        Layer (type)                                Output Shape         Param #\n",
      "================================================================================\n",
      "               Input                              (1, 1, 28, 28)               0\n",
      "        Activation-1  <Symbol autoencoder_encoder_conv0_relu_fwd>               0\n",
      "        Activation-2                              (1, 4, 14, 14)               0\n",
      "            Conv2D-3                              (1, 4, 14, 14)              40\n",
      "         BatchNorm-4                              (1, 4, 14, 14)              16\n",
      "        Activation-5  <Symbol autoencoder_encoder_conv1_relu_fwd>               0\n",
      "        Activation-6                                (1, 8, 7, 7)               0\n",
      "            Conv2D-7                                (1, 8, 7, 7)             296\n",
      "         BatchNorm-8                                (1, 8, 7, 7)              32\n",
      "        Activation-9  <Symbol autoencoder_encoder_conv2_relu_fwd>               0\n",
      "       Activation-10                               (1, 16, 4, 4)               0\n",
      "           Conv2D-11                               (1, 16, 4, 4)            1168\n",
      "        BatchNorm-12                               (1, 16, 4, 4)              64\n",
      "       Activation-13  <Symbol autoencoder_encoder_conv3_relu_fwd>               0\n",
      "       Activation-14                               (1, 32, 1, 1)               0\n",
      "           Conv2D-15                               (1, 32, 1, 1)            4640\n",
      "        BatchNorm-16                               (1, 32, 1, 1)             128\n",
      "       Activation-17  <Symbol autoencoder_decoder_conv0_relu_fwd>               0\n",
      "       Activation-18                               (1, 32, 3, 3)               0\n",
      "           Conv2D-19                               (1, 32, 3, 3)            9248\n",
      "     HybridLambda-20                               (1, 32, 6, 6)               0\n",
      "        BatchNorm-21                               (1, 32, 6, 6)             128\n",
      "       Activation-22  <Symbol autoencoder_decoder_conv1_relu_fwd>               0\n",
      "       Activation-23                               (1, 16, 6, 6)               0\n",
      "           Conv2D-24                               (1, 16, 6, 6)            4624\n",
      "     HybridLambda-25                             (1, 16, 12, 12)               0\n",
      "        BatchNorm-26                             (1, 16, 12, 12)              64\n",
      "       Activation-27  <Symbol autoencoder_decoder_conv2_relu_fwd>               0\n",
      "       Activation-28                              (1, 8, 14, 14)               0\n",
      "           Conv2D-29                              (1, 8, 14, 14)            1160\n",
      "     HybridLambda-30                              (1, 8, 28, 28)               0\n",
      "        BatchNorm-31                              (1, 8, 28, 28)              32\n",
      "       Activation-32  <Symbol autoencoder_decoder_conv3_relu_fwd>               0\n",
      "       Activation-33                              (1, 4, 28, 28)               0\n",
      "           Conv2D-34                              (1, 4, 28, 28)             292\n",
      "       Activation-35  <Symbol autoencoder_decoder_conv4_sigmoid_fwd>               0\n",
      "       Activation-36                              (1, 1, 28, 28)               0\n",
      "           Conv2D-37                              (1, 1, 28, 28)              37\n",
      "================================================================================\n",
      "Parameters in forward computation graph, duplicate included\n",
      "   Total params: 21969\n",
      "   Trainable params: 21737\n",
      "   Non-trainable params: 232\n",
      "Shared params in forward computation graph: 0\n",
      "Unique parameters in model: 21969\n",
      "--------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "net.summary(test_dataset_t[0][0].expand_dims(axis=0).as_in_context(ctx))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can see that the original image goes from 28x28 = 784 pixels to a vector of length 32. That is a ~25x information compression rate.\n",
    "Then the decoder brings back this compressed information to the original shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "l2_loss = gluon.loss.L2Loss()\n",
    "l1_loss = gluon.loss.L1Loss()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "trainer = gluon.Trainer(net.collect_params(), 'adam', {'learning_rate': 0.001, 'wd':0.001})\n",
    "net.hybridize(static_shape=True, static_alloc=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Training loop"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch [0], Loss 0.2246280246310764\n",
      "Epoch [1], Loss 0.14493223337026742\n",
      "Epoch [2], Loss 0.13147933666522688\n",
      "Epoch [3], Loss 0.12138325943906084\n",
      "Epoch [4], Loss 0.11291297684367906\n",
      "Epoch [5], Loss 0.10611823453741559\n",
      "Epoch [6], Loss 0.09942417470817892\n",
      "Epoch [7], Loss 0.09408332955124032\n",
      "Epoch [8], Loss 0.08883619716024807\n",
      "Epoch [9], Loss 0.08491455795418502\n",
      "Epoch [10], Loss 0.0809355994402352\n",
      "Epoch [11], Loss 0.07784551636785524\n",
      "Epoch [12], Loss 0.07570812029716296\n",
      "Epoch [13], Loss 0.07417513366438384\n",
      "Epoch [14], Loss 0.07218785571236895\n",
      "Epoch [15], Loss 0.07093704352944584\n",
      "Epoch [16], Loss 0.0700181406787318\n",
      "Epoch [17], Loss 0.0689836893326197\n",
      "Epoch [18], Loss 0.06782063459738708\n",
      "Epoch [19], Loss 0.06713279088338216\n"
     ]
    }
   ],
   "source": [
    "epochs = 20\n",
    "for e in range(epochs):\n",
    "    curr_loss = 0.\n",
    "    for i, (data, _) in enumerate(train_data):\n",
    "        data = data.as_in_context(ctx)\n",
    "        with autograd.record():\n",
    "            output = net(data)\n",
    "            # Compute the L2 and L1 losses between the original and the generated image\n",
    "            l2 = l2_loss(output.flatten(), data.flatten())\n",
    "            l1 = l1_loss(output.flatten(), data.flatten())\n",
    "            l =  l2 + l1 \n",
    "        l.backward()\n",
    "        trainer.step(data.shape[0])\n",
    "        \n",
    "        curr_loss += l.mean()\n",
    "\n",
    "    print(\"Epoch [{}], Loss {}\".format(e, curr_loss.asscalar()/(i+1)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Testing reconstruction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We plot 10 images and their reconstruction by the autoencoder. The results are pretty good for a ~25x compression rate!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABIEAAAD4CAYAAAB7VPbbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzsvWe8XVXVvj1QsQKBkJCQQiqBhEQ6gRBaIIAoIE1BimAB8UcVBfUvIGIBFSygPHZ/IihFRVSU3psGQpASEtJIJw0CKPqIvB98mc8975w13Qmn7LPXdX0aO3Oetdeefa2Me4y1Xn311QAAAAAAAAAAgNbmDV19AwAAAAAAAAAA0PHwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAbwEggAAAAAAAAAoAa8qTO/bK211nq1M79POfLII5N92mmnJfuHP/xhVm/lypXJnj59erI33njjrF6fPn2SPWbMmKxsyy23TPZ5552X7DvuuCOr9+qrndccr7766lrtcZ2u7MO60159GNE8/divX79kjx8/Pit77LHHkv32t7892f/617+yeltssUWy586dm5XdddddDd3HWmv9X9N29LxkLnZ/WnEudgfe+MY3JvuVV15Zo2u84Q3/939fr7zySrebi7pWRVSvV/Pnz88+L1iwINl/+9vfkv2Pf/wjq6efn3vuuaxs3XXXTfbChQuTrWtwRMRJJ52U7EcffbTN+2svutNc1L5be+21szLd1/79738nW8d8RETv3r2TvWTJkjb/xv9u2LBhWdm0adOSrePnTW+qfiTwfbe990z2xe5Pd5qLjbLJJpsk+5lnnmn36x911FHJ/vnPf97u118TuuNcHDhwYPZZn8MnTpyY7P/93//N6ukzwwMPPJBs3xe1nq+1hx56aLL33XffZP/ud7/L6l133XXJ9r21vWm0D/EEAgAAAAAAAACoAWt1pjdKe78V3H333bPPxx57bLJHjx6dlen/mLzwwgvJ7tu3b1ZP/+6ll15Ktv9vzDrrrJPsp556KivT/4HTt8j+P3jLli1L9g9+8IOs7Kqrror2pDu+2YWcVvlflhNPPDHZu+yyS7KPOOKIrN7y5cuTvf766yfb59vIkSOTfeONN2Zl6n333e9+N9nq8dfZMBe7P60yFzsS9fKLyL1xf/Ob3yR71qxZWb019fBZE7rjXCx5Au22227Jvuyyy7J6zz77bLLVG+otb3lLVk/XXf8fz/XWWy/Z8+bNS3aPHj2yep/73OeS/fDDD7fxK9qPZpiLVV4x2s4Rq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tsdd9wx2RoHISLXItZJJ1oXOirVbmkuapnH+jn//POTrbE8vvvd77bzHXYs3q6qE/7jH/+YlWnKR42D4fFQdD77+tMR/ahz32OWdWe8rRpdaxUf02uiq/bvqooN9XpR7bmv4Rq7xWPgzZo1K9k69jwegWrUPQaeftY54L9d06prTKDly5dn9TSOnsdgqOqD66+/Pvt8++23J9vj1Wi8Lv0ubzfV4vv3ekyG9qAr56L2lZ5zfvSjH2X1dtttt2RXxT6MyNe4mTNnZmWXXnppsjfYYINk33bbbat726+LZktBr2P2kksuSfZzzz2X1dNU8v4bmiFGkN+TxtW49957s7IhQ4YkW9cij4PR2ej47W6xCbsjpVTmr4fSGbU9+MMf/pDsyZMn/3/t3UEKwjAURdG4/+VmA46Elw8VFIXCO2daqKVIEy/lexzLdSY/e/4Nec6TyeudcyXzezhn1+T9y33jXFtzHt67/eUdniMvv7iuvF/5nFnr/J2cc5zWOvcEeY451ynnJOYeb+4T8nxzzby63r33cSyfTfMcORMovy+frBPfrIveBAIAAAAoIAIBAAAAFHjc6dUxAAAAAP7Dm0AAAAAABUQgAAAAgAIiEAAAAEABEQgAAACggAgEAAAAUEAEAgAAACggAgEAAAAUEIEAAAAACohAAAAAAAVEIAAAAIACIhAAAABAAREIAAAAoIAIBAAAAFBABAIAAAAoIAIBAAAAFBCBAAAAAAqIQAAAAAAFRCAAAACAAiIQAAAAQAERCAAAAKCACAQAAABQQAQCAAAAKCACAQAAABR4AtsFOibRgZuZAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1440x288 with 20 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(20,4))\n",
    "for i in range(10):\n",
    "    idx = random.randint(0, len(test_dataset))\n",
    "    img, _ = test_dataset[idx]\n",
    "    x, _ = test_dataset_t[idx]\n",
    "\n",
    "    data = x.as_in_context(ctx).expand_dims(axis=0)\n",
    "    output = net(data)\n",
    "    \n",
    "    ax = plt.subplot(2, 10, i+1)\n",
    "    ax.imshow(img.squeeze().asnumpy(), cmap='gray')\n",
    "    ax.axis('off')\n",
    "    ax = plt.subplot(2, 10, 10+i+1)\n",
    "    ax.imshow((output[0].asnumpy() * 255.).transpose((1,2,0)).squeeze(), cmap='gray')\n",
    "    _ = ax.axis('off')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Manipulating latent space"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We now use separately the **encoder** that takes an image to a latent vector and the **decoder** that transform a latent vector into images"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We get two images from the testing set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJIAAACPCAYAAAARM4LLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAACsxJREFUeJztnduLFdkVxr9le7/ftdXWUdFRCUJkCMYEEaOo8zIP4hWCoOBLAgkEzEzyByiCeRCDIEYnD9EYiKAEYYjaAwbjoNHBqENPa7z1qPF+v7buPHR5sven59Q5fbbn1LG/HzRdX+06Vbu7V++9au1Vq8w5ByHKpVO1OyDeD2RIIgoyJBEFGZKIggxJREGGJKIgQxJRkCGJKJRlSGY238yazOysmX0aq1Oi9rD2RrbNrA7AtwDmAmgBcBTAMufcmQKfURi99rjpnBuSdlA5I9IPAJx1zv3HOfccwJ8BfFLG+UQ2uVjMQeUY0kgAlz3dkuwLMLPVZnbMzI6VcS2RcTq/6ws457YA2AJoanufKWdE+g5Ag6dHJftEB6QcQzoKYIKZjTWzrgCWAtgbp1ui1mj31OacazWznwP4AkAdgG3OudPReiZqinbf/rfrYvKRapF/Oec+SjtIkW0RBRmS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 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f04995adc50>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJIAAACPCAYAAAARM4LLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAACZRJREFUeJztnUtsVdcVhv+Feb8JD2Nsg4OwKjFAqhRVoFYC0SJoJmFUBUHEIBKTVmqlSCRph0zKpLNOkEDpoHJVqZWSQSSrRNSoUIE9iKgJAkwRD2Owzdvmadgd3Bv37D/xvde+y/eew/k/yeL851zfsxP93nudvddex0IIEKJaZtS7AeLNQEYSLshIwgUZSbggIwkXZCThgowkXJCRhAtVGcnMdpnZRTPrM7NPvBolsodNdWbbzBoAXAKwA8BNAN0A9oQQvinxO6mdRm9tbS15fWxsLNIzZsz43mMAGB0djfS8efMi/eLFi0i/fv060g0NDZEeGRmJ9JMnT0q21ZnhEMLKch+aWcUNfgSgL4TwXwAws78AeA/AhEZKMwcPHix5/e7du5GeP3/++PHs2bOjaz09PZHetGlTpK9fvx5pNt6iRYsiffr06ZLfP81cq+RD1QxtzQBuJPTN4rkIMztgZj1mVtP/elFbqumRKiKEcATAESDdQ5uojmqM1A8gGVi0FM9lkm3btkV6+fLlkX7w4EGkk0Pdhg0bomtbt26NdHIYBIDjx49H+vnz55HmmOvZs2eRrvHQVhHVDG3dANrN7G0zmw3gfQBf+DRLZI0p90ghhDEz+xWATgANAI6FEM67tUxkiqpipBDClwC+dGqLyDDTHmynldWrV0d61qxZke7s7Iz0nDlzIp2cG1qyZEl0bebM+H/rrVu3Iv348eNI8/QAx0SnTp1C2tESiXBBRhIuy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TUDs9ibfOaGcnMGgD8EcDPAWwEsKdYr7tefAZgF51LS+3w7NU2DyHU5AfAFgCdCf0pgE9rdf8J2tQGoDehLwJoKh43AbhYz/Yl2vU5gB1pbV8IoaZDWzOAZNX0m8VzaSJ1tcOzUttcwfYEhMKffV0fabm2efJaGtqXpJZG6gfQmtAtxXNpoqLa4bWgmtrm9aCWRuoG0G5mb5vZbADvo1CrO018WzscqGPt8ApqmwNpq21e46DxXQCXAFwB8Ls6B7AdKLys5yUK8dqHAJaj8DR0GcBxAG/VqW0/QWHYOgfg6+LPu2lp3/f9aGZbuKBgW7ggIwkXZCThgowkXJCRhAsyknBBRhIuyEjChf8BBBgORVqd9YYAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 144x144 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "idx = random.randint(0, len(test_dataset))\n",
    "img1, _ = test_dataset[idx]\n",
    "x, _ = test_dataset_t[idx]\n",
    "data1 = x.as_in_context(ctx).expand_dims(axis=0)\n",
    "\n",
    "idx = random.randint(0, len(test_dataset))\n",
    "img2, _ = test_dataset[idx]\n",
    "x, _ = test_dataset_t[idx]\n",
    "data2 = x.as_in_context(ctx).expand_dims(axis=0)\n",
    "\n",
    "plt.figure(figsize=(2,2))\n",
    "plt.imshow(img1.squeeze().asnumpy(), cmap='gray')\n",
    "plt.show()\n",
    "plt.figure(figsize=(2,2))\n",
    "plt.imshow(img2.squeeze().asnumpy(), cmap='gray')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We get the latent representations of the images by passing them through the network"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "latent1 = encoder(data1)\n",
    "latent2 = encoder(data2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We see that the latent vector is made of 32 components"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1, 32, 1, 1)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "latent1.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We interpolate the two latent representations, vectors of 32 values, to get a new intermediate latent representation, pass it through the decoder and plot the resulting decoded image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABIEAAACBCAYAAABXearSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3WmMXlUdx/GDC/vSZVraaaEtpS1d6AIFoYSqBRUqpCAISCIkShBBUZREjb4QQnjhQmKMJmCihqAoCCIKmoJhL1vL0tZSoHTfpmVaWmhR2XyBHH7nN3MOT6fzzDzz3O/n1X9679zn9p57zr3z5Pz/Z4933nknAAAAAAAAoLl9qLdPAAAAAAAAAPXHl0AAAAAAAAAVwJdAAAAAAAAAFcCXQAAAAAAAABXAl0AAAAAAAAAVwJdAAAAAAAAAFcCXQAAAAAAAABXAl0AAAAAAAAAVwJdAAAAAAAAAFfCRnvywPfbY452e/Lyq+9CH3v+O76233tqjO45JG/asD3/4wzF+8803u6UNQ6Ade9pHPvL+UPvGG2/QF/ugerRhCLRjT6vHmNoX2lDfB/bYY49O4xBCeOed9/8rb7/9dvZ4ul9Pq8e7TQiN2Y467oQQwt577x3jj370o9n93nrrrRj/97//Tba9+eabncb6OyHUv4313nv77bebqi9qe/Tv3z/Z1traGuO99torxnvuuWeyn/a/1157Ldm2Y8eOGG/btq3TOIQQ3njjjV057V1Wjzb8/3F7rR31/zRkyJAYH3fcccl+I0aMiPG///3vGHs/0j6m+/m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vT11m6cRafqLLlHtfdbHV3TkKXOaFqlpfZ5ypM/JWttRU75CSN+tNPY+q22MjrxttB/os8rfZXNplaU23HvvvZNtuTb09+RGfJdlJhAAAAAAAEAF8CUQAAAAAABABfAlEAAAAAAAQAX0aE2gUr4dup/nEHcHzZ9sxPzGZqP5+t2piu1Y63L09fgszyHuDlVpQ72WpWdIV9pwV2qL7Lvvvrt8/FroOO21eOpN75vSPdQd1za3LLUvm1rvdtxvv/12+fgfRJeMrXftBr8+69at6zT2e6nWMUKvpR9DlydftmxZjH2J5dI9redfarfStnr1xXq3Y+nazps3L8almllaX6Y0Hmq/2rZtW7Ltb3/7W4yHDBkS44ULFyb7aTuW+nNJqR3r8VzsyTb0a/Dggw/GWGs5eRsuX748xnqN/Xi6zeu5aR2u1tbWGGvNqBDyNU86+7yuqNc7ar2fi3pd/G8lvYZbtmzJnocuJa/XwevO6D3p9aHuvvvuGA8fPjzGzz33XPbc69GOvux5d+jNNpw/f36Mt2/fHmO/Vlo7qNSGenyvlabj6ahRo2Ksz8ue0JW/+ZkJBAAAAAAAUAF8CQQAAAAAAFABe5CWBQAAAAAA0PyYCQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAXwJBAAAAAAAUAF8CQQAAAAAAFABfAkEAAAAAABQAf8DK5G1n+VBYMIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1440x360 with 10 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "num = 10\n",
    "plt.figure(figsize=(20, 5))\n",
    "\n",
    "for i in range(int(num)):\n",
    "    \n",
    "        new_latent = latent2*(i+1)/num + latent1*(num-i)/num\n",
    "        output = decoder(new_latent)\n",
    "        \n",
    "        #plot result\n",
    "        ax = plt.subplot(1, num, i+1)\n",
    "        ax.imshow((output[0].asnumpy() * 255.).transpose((1,2,0)).squeeze(), cmap='gray')\n",
    "        _ = ax.axis('off')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can see that the latent space learnt by the autoencoder is fairly smooth, there is no sudden jump from one shape to another"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
